package com.acane.instagram.pojo;

import com.acane.instagram.pojo.dto.ChatDTO;
import com.acane.instagram.pojo.dto.CommentDTO;
import com.acane.instagram.pojo.dto.CommentLikeDTO;
import com.acane.instagram.pojo.dto.LikeDTO;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import lombok.Data;



@Data
public class Message<T> {
    private NotifyType type;

    @JsonTypeInfo(
            use = JsonTypeInfo.Id.NAME,
            include = JsonTypeInfo.As.EXTERNAL_PROPERTY,
            property = "type"
    )
    @JsonSubTypes({
            @JsonSubTypes.Type(value = ChatDTO.class, name = "CHAT_MESSAGE"),
            @JsonSubTypes.Type(value = LikeDTO.class, name = "POST_LIKE"),
            @JsonSubTypes.Type(value = CommentDTO.class, name = "POST_COMMENT"),
            @JsonSubTypes.Type(value = CommentLikeDTO.class, name = "COMMENT_LIKE"),
    })
    private T data;
}



